﻿//==================================================================
// Copyright (C) 2011 深圳市中旭企业管理股份有限公司
// 文件名: V_CrmLiveOrDerManager.cs
// 作 者：代码自动生成
// 日 期：2012-11-14 16:33:22
// 描 述：
// 版 本：1.00
// 修改历史纪录
// 版 本  修改时间      修改人            修改内容
// 1.00             
//==================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Csla;
using lite;
using Csla.Validation;
using Csla.Data;
using System.Data.SqlClient;
using ZX.DAL;
using OpenExpressApp.ORM;

namespace ZX.CRM.Library
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    [Table(Name = "V_CrmLiveOrDerManager")]
    [ZX.DBModule.Table("V_CrmLiveOrDerManager", "ID")]
    public class V_CrmLiveOrDerManager : ZX.DBModule.BaseEntity
    {
        #region Business Methods 业务方法
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> IDProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("ID"));
        [DataObjectField(true, true)]
        [Column, PK]
        public Guid ID
        {
            get { return GetProperty(IDProperty); }
            set { SetProperty(IDProperty, value); }
        }

        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> IsInvoiceProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("IsInvoice"));
        [Column]
        public string IsInvoice
        {
            get { return GetProperty(IsInvoiceProperty); }
            set { SetProperty(IsInvoiceProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> InvoiceNumProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("InvoiceNum"));
        [Column]
        public string InvoiceNum
        {
            get { return GetProperty(InvoiceNumProperty); }
            set { SetProperty(InvoiceNumProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> PayTypeProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("PayType"));
        [Column]
        public Guid PayType
        {
            get { return GetProperty(PayTypeProperty); }
            set { SetProperty(PayTypeProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> POSNumProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("POSNum"));
        [Column]
        public string POSNum
        {
            get { return GetProperty(POSNumProperty); }
            set { SetProperty(POSNumProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> PactNumProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("PactNum"));
        [Column]
        public string PactNum
        {
            get { return GetProperty(PactNumProperty); }
            set { SetProperty(PactNumProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> ReceiptNumProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("ReceiptNum"));
        [Column]
        public string ReceiptNum
        {
            get { return GetProperty(ReceiptNumProperty); }
            set { SetProperty(ReceiptNumProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> ExplainProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("Explain"));
        [Column]
        public string Explain
        {
            get { return GetProperty(ExplainProperty); }
            set { SetProperty(ExplainProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> AddUserProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("AddUser"));
        [Column]
        public Guid AddUser
        {
            get { return GetProperty(AddUserProperty); }
            set { SetProperty(AddUserProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> CourseLayoutIDProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("CourseLayoutID"));
        [Column]
        public Guid CourseLayoutID
        {
            get { return GetProperty(CourseLayoutIDProperty); }
            set { SetProperty(CourseLayoutIDProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> CustomerIDProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("CustomerID"));
        [Column]
        public Guid CustomerID
        {
            get { return GetProperty(CustomerIDProperty); }
            set { SetProperty(CustomerIDProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CustomerMgrNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("CustomerMgrName"));
        [Column]
        public string CustomerMgrName
        {
            get { return GetProperty(CustomerMgrNameProperty); }
            set { SetProperty(CustomerMgrNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> OrderofDeptNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("OrderofDeptName"));
        [Column]
        public string OrderofDeptName
        {
            get { return GetProperty(OrderofDeptNameProperty); }
            set { SetProperty(OrderofDeptNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CustomerNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("CustomerName"));
        [Column]
        public string CustomerName
        {
            get { return GetProperty(CustomerNameProperty); }
            set { SetProperty(CustomerNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> SaleadviserNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("SaleadviserName"));
        [Column]
        public string SaleadviserName
        {
            get { return GetProperty(SaleadviserNameProperty); }
            set { SetProperty(SaleadviserNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> AddUserNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("AddUserName"));
        [Column]
        public string AddUserName
        {
            get { return GetProperty(AddUserNameProperty); }
            set { SetProperty(AddUserNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> LectorNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("LectorName"));
        [Column]
        public string LectorName
        {
            get { return GetProperty(LectorNameProperty); }
            set { SetProperty(LectorNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> NegotiateTeachNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("NegotiateTeachName"));
        [Column]
        public string NegotiateTeachName
        {
            get { return GetProperty(NegotiateTeachNameProperty); }
            set { SetProperty(NegotiateTeachNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> ClassServerNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("ClassServerName"));
        [Column]
        public string ClassServerName
        {
            get { return GetProperty(ClassServerNameProperty); }
            set { SetProperty(ClassServerNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> ClassFrontServerNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("ClassFrontServerName"));
        [Column]
        public string ClassFrontServerName
        {
            get { return GetProperty(ClassFrontServerNameProperty); }
            set { SetProperty(ClassFrontServerNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CreateUserNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("CreateUserName"));
        [Column]
        public string CreateUserName
        {
            get { return GetProperty(CreateUserNameProperty); }
            set { SetProperty(CreateUserNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> OriginNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("OriginName"));
        [Column]
        public string OriginName
        {
            get { return GetProperty(OriginNameProperty); }
            set { SetProperty(OriginNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> TradeNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("TradeName"));
        [Column]
        public string TradeName
        {
            get { return GetProperty(TradeNameProperty); }
            set { SetProperty(TradeNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CustomerCodeProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("CustomerCode"));
        [Column]
        public string CustomerCode
        {
            get { return GetProperty(CustomerCodeProperty); }
            set { SetProperty(CustomerCodeProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CompanyProductProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("CompanyProduct"));
        [Column]
        public string CompanyProduct
        {
            get { return GetProperty(CompanyProductProperty); }
            set { SetProperty(CompanyProductProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> ProductPackProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("ProductPack"));
        [Column]
        public Guid ProductPack
        {
            get { return GetProperty(ProductPackProperty); }
            set { SetProperty(ProductPackProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<DateTime> AddTimeProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<DateTime>("AddTime"));
        [Column]
        public DateTime AddTime
        {
            get { return GetProperty(AddTimeProperty); }
            set { SetProperty(AddTimeProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<decimal> AllMoneyProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<decimal>("AllMoney"));
        [Column]
        public decimal AllMoney
        {
            get { return GetProperty(AllMoneyProperty); }
            set { SetProperty(AllMoneyProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> PacknameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("Packname"));
        [Column]
        public string Packname
        {
            get { return GetProperty(PacknameProperty); }
            set { SetProperty(PacknameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<decimal> TotalRebateProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<decimal>("TotalRebate"));
        [Column]
        public decimal TotalRebate
        {
            get { return GetProperty(TotalRebateProperty); }
            set { SetProperty(TotalRebateProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<decimal> TotalMoneyProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<decimal>("TotalMoney"));
        [Column]
        public decimal TotalMoney
        {
            get { return GetProperty(TotalMoneyProperty); }
            set { SetProperty(TotalMoneyProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<decimal> ResignMoneyProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<decimal>("ResignMoney"));
        [Column]
        public decimal ResignMoney
        {
            get { return GetProperty(ResignMoneyProperty); }
            set { SetProperty(ResignMoneyProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<decimal> UnPayMoneyProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<decimal>("UnPayMoney"));
        [Column]
        public decimal UnPayMoney
        {
            get { return GetProperty(UnPayMoneyProperty); }
            set { SetProperty(UnPayMoneyProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<Guid> CrmDeliverMajorIDProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<Guid>("CrmDeliverMajorID"));
        [Column]
        public Guid CrmDeliverMajorID
        {
            get { return GetProperty(CrmDeliverMajorIDProperty); }
            set { SetProperty(CrmDeliverMajorIDProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> SignNameProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("SignName"));
        [Column]
        public string SignName
        {
            get { return GetProperty(SignNameProperty); }
            set { SetProperty(SignNameProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> NegotiateTeachIDProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("NegotiateTeachID"));
        [Column]
        public string NegotiateTeachID
        {
            get { return GetProperty(NegotiateTeachIDProperty); }
            set { SetProperty(NegotiateTeachIDProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> CaptionProperty = RegisterProperty(typeof(V_CrmLiveOrDerManager), new PropertyInfo<string>("Caption"));
        [Column]
        public string Caption
        {
            get { return GetProperty(CaptionProperty); }
            set { SetProperty(CaptionProperty, value); }
        }
        #endregion

        #region Validation Rules 验证规则
        //将验证规则与业务对象的属性联系在一起
        protected override void AddBusinessRules()
        {
            //AddRule的第一个参数是委托变量，也就是说是方法的变量
            ValidationRules.AddRule(CommonRules.StringRequired, "IsInvoice");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("IsInvoice", 2));
            ValidationRules.AddRule(CommonRules.StringRequired, "InvoiceNum");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("InvoiceNum", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "POSNum");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("POSNum", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "PactNum");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("PactNum", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "ReceiptNum");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("ReceiptNum", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "Explain");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Explain", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerMgrName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerMgrName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "OrderofDeptName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OrderofDeptName", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerName", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "SaleadviserName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("SaleadviserName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "AddUserName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("AddUserName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "LectorName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("LectorName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "NegotiateTeachName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("NegotiateTeachName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "ClassServerName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("ClassServerName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "ClassFrontServerName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("ClassFrontServerName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "CreateUserName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CreateUserName", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "OriginName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OriginName", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "TradeName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TradeName", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerCode");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerCode", 15));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompanyProduct");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompanyProduct", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "Packname");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Packname", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "SignName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("SignName", -1));
            ValidationRules.AddRule(CommonRules.StringRequired, "NegotiateTeachID");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("NegotiateTeachID", 1000));
            ValidationRules.AddRule(CommonRules.StringRequired, "Caption");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Caption", 50));
            //base.AddBusinessRules();
        }
        #endregion

        #region Factory Methods 工厂方法

        public V_CrmLiveOrDerManager() { }

        public static V_CrmLiveOrDerManager New()
        {
            return DataPortal.Create<V_CrmLiveOrDerManager>();
        }
        public static V_CrmLiveOrDerManager Get(Guid ID)
        {
            return DataPortal.Fetch<V_CrmLiveOrDerManager>(new SingleLazyCriteria<V_CrmLiveOrDerManager, Guid>(ID, false));
        }
        public static void Delete(Guid ID)
        {
            DataPortal.Delete(ID);
        }

        #endregion

        #region Data Access 数据访问
        //由于DataPortal_create中没有对数据库的访问，所有标记了Runlocal特性，使得该方法只需在本地运行即可
        //如果代码中有访问数据库的方法，那么就不要用这个特性，使数据门户可以根据情况将此方法的运行选择在应用服务器还是本地
        [RunLocal()]
        protected override void DataPortal_Create()
        {
            //在此调用CheckRules对所有的属性进行验证规则的检查，这样检查只运行一次。
            ValidationRules.CheckRules();
        }


        //可以看到此方法没有标记任何特性
        //此方法要访问数据库所以不能标记本地，由于她没有任何数据库更新操作所以也无需事务性的保护
        //此方法调用结束后会隐含的调用MarkOld（）方法
        private void DataPortal_Fetch(Guid ID)
        {
            //通过连接字符串建立SQL连接对象，Using符号代表，范围释放的意思，SqlConnection对象会在此范围后被释放掉
            using (var ctx = ConnectionManager<SqlConnection>.GetManager(ConnectionStringNames))
            {
                IDb db = DbFactory.Instance.GetDb(ctx.Connection);
                IQuery q = db.Query();
                q.Constrain("ID").Equal(ID);

                var data = db.Select<V_CrmLiveOrDerManager>(q)[0];
                LoadProperty(IDProperty, data.ID);
                LoadProperty(IsInvoiceProperty, data.IsInvoice);
                LoadProperty(InvoiceNumProperty, data.InvoiceNum);
                LoadProperty(PayTypeProperty, data.PayType);
                LoadProperty(POSNumProperty, data.POSNum);
                LoadProperty(PactNumProperty, data.PactNum);
                LoadProperty(ReceiptNumProperty, data.ReceiptNum);
                LoadProperty(ExplainProperty, data.Explain);
                LoadProperty(AddUserProperty, data.AddUser);
                LoadProperty(CourseLayoutIDProperty, data.CourseLayoutID);
                LoadProperty(CustomerIDProperty, data.CustomerID);
                LoadProperty(CustomerMgrNameProperty, data.CustomerMgrName);
                LoadProperty(OrderofDeptNameProperty, data.OrderofDeptName);
                LoadProperty(CustomerNameProperty, data.CustomerName);
                LoadProperty(SaleadviserNameProperty, data.SaleadviserName);
                LoadProperty(AddUserNameProperty, data.AddUserName);
                LoadProperty(LectorNameProperty, data.LectorName);
                LoadProperty(NegotiateTeachNameProperty, data.NegotiateTeachName);
                LoadProperty(ClassServerNameProperty, data.ClassServerName);
                LoadProperty(ClassFrontServerNameProperty, data.ClassFrontServerName);
                LoadProperty(CreateUserNameProperty, data.CreateUserName);
                LoadProperty(OriginNameProperty, data.OriginName);
                LoadProperty(TradeNameProperty, data.TradeName);
                LoadProperty(CustomerCodeProperty, data.CustomerCode);
                LoadProperty(CompanyProductProperty, data.CompanyProduct);
                LoadProperty(ProductPackProperty, data.ProductPack);
                LoadProperty(AddTimeProperty, data.AddTime);
                LoadProperty(AllMoneyProperty, data.AllMoney);
                LoadProperty(PacknameProperty, data.Packname);
                LoadProperty(TotalRebateProperty, data.TotalRebate);
                LoadProperty(TotalMoneyProperty, data.TotalMoney);
                LoadProperty(ResignMoneyProperty, data.ResignMoney);
                LoadProperty(UnPayMoneyProperty, data.UnPayMoney);
                LoadProperty(CrmDeliverMajorIDProperty, data.CrmDeliverMajorID);
                LoadProperty(SignNameProperty, data.SignName);
                LoadProperty(NegotiateTeachIDProperty, data.NegotiateTeachID);
                LoadProperty(CaptionProperty, data.Caption);
            }
        }

        [Transactional(TransactionalTypes.TransactionScope)]
        protected override void DataPortal_DeleteSelf()
        {
            //依然是调用下面的方法删除的，只是他此时可以获得自己的Id
            DataPortal_Delete(IDProperty);
        }
        #endregion
    }
}

